package core
{
	
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	
	import jazztures.objects.Skeleton;
	
	import ui.DollModeler;
	
	[SWF(width=800, height=800, frameRate=30, backgroundColor=0x000000)]
	public class SkeletonModeler extends Sprite
	{		
		private var modeler:DollModeler;
	
		public function SkeletonModeler()
		{
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			
			addEventListener(Event.ADDED_TO_STAGE, startModeler);
		}
		
		private function startModeler(evt:Event):void{
			removeEventListener(Event.ADDED_TO_STAGE, startModeler);
			build();					
		}
		
		protected function build():void{
			modeler = new DollModeler(stage.stageWidth/2, stage.stageHeight);
			addChild(modeler);
			modeler.addEventListener(Event.CHANGE, updateSkeleton);
		}
		
		private function updateSkeleton(evt:Event):void{
			update(modeler.skeleton);
			
		}
		
		protected function update(skeleton:Skeleton):void{
			
		}
	}
}